home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / curses.h < prev    next >
C/C++ Source or Header  |  1993-11-22  |  47KB  |  1,157 lines

  1. /* $Header: C:\CURSES\RCS\curses.h 2.1 1993/06/18 20:18:36 MH Rel MH $
  2. *----------------------------------------------------------------------
  3. *                PDCurses
  4. *----------------------------------------------------------------------
  5. * MH
  6. *    930531    2.1    Added support for djgpp
  7. *
  8. *            Added beta Unix version
  9. *
  10. *            Added OS/2 DLL support.
  11. *
  12. *            Changed behaviour of overlay(), overwrite() and typeahead()
  13. *
  14. *    921120    2.0    Changed #if to #ifdef/#if defined to make it
  15. *            easier to add new platforms/compilers.
  16. *
  17. *            Added System V colour support.
  18. *
  19. *            Added OS/2 port.
  20. *-------
  21. * Frotz
  22. *    911221    2.0 pre-beta    Changed back from short to int. (int is the
  23. *            correct size for the default platform.  Short
  24. *            might be too short on some platforms.  This
  25. *            is more portable.  I, also, made this mistake.)
  26. *
  27. *            Many functions are now macros.  If you want
  28. *            the real thing, #undef the macro. (X/Open
  29. *            requirement.)
  30. *
  31. *            Merged many sources into current release.
  32. *
  33. *            Added many X/Open routines (not quite all yet).
  34. *
  35. *            Added internal documentation to all routines.
  36. *
  37. *            Added a HISTORY file to the environment.
  38. *
  39. *            Added a CONTRIB file to the environment.
  40. *-------
  41. * bl    900114    1.4    Window origin mod in overlay() and overwrite(), on
  42. *            public (and very reasonable) request. Swapped
  43. *            #define'd values of OK and ERR; OK now 1, and
  44. *            ERR is 0/NULL. Conforms better to UNIX
  45. *            versions.  borderchars[] removed from WINDOW
  46. *            struct since the border() functions were
  47. *            redefined. Use of short wherever possible.
  48. *            Portability improvements, mispelled name of
  49. *            [w]setscrreg().
  50. *
  51. *    881005    1.3    All modules lint-checked with MSC '-W3' and
  52. *            turbo'C' '-w -w-pro' switches. Support for
  53. *            border(), wborder() functions.
  54. *
  55. *    881002    1.2    Rcsid[] string in all modules, for maintenance.
  56. *
  57. *    880306    1.1    'Raw' output routines, revision info in curses.h.
  58. *
  59. *    870515    1.0    Initial Release.
  60. *
  61. *----------------------------------------------------------------------
  62. */
  63.  
  64. #ifndef  __PDCURSES__
  65. #define    __PDCURSES__ 1
  66.  
  67. /*man-start*********************************************************************
  68.  
  69. All defines are "defined" here.  All compiler and environment
  70. specific definitions are defined into generic class defines.
  71. These defines are to be given values so that the code can
  72. rely on #if, rather than a complicated set of #if defined() or
  73. #ifdefs...
  74.  
  75. PDCurses definitions list:  (Only define those needed)
  76.  
  77.     REGISTERWINDOWS True for auto window update registery.
  78.     FAST_VIDEO      True if display is memory mapped, or
  79.                     we can utilize the fast video update routines.
  80.     DOS             True if compiling for DOS.
  81.     OS2             True if compiling for OS/2.
  82.     FLEXOS          True if compiling for Flexos.
  83.     HC              True if using a Metaware compiler.
  84.     TC              True if using a Borland compiler.
  85.     MSC             True if using a Microsoft compiler.
  86.     ANSI            True if the compiler supports ANSI C and
  87.                     (full or mixed) prototypes.
  88.     CPLUSPLUS       True if the compiler supports C++.
  89.  
  90. PDCurses portable platform definitions list:
  91.  
  92.     PDCurses        Enables access to PDCurses-only routines.
  93.     XOPEN           Always true.
  94.     SYSV            True if you are compiling for SYSV portability.
  95.     BSD             True if you are compiling for BSD portability.
  96.     INTERNAL        Enables access to internal PDCurses routines.
  97. **man-end**********************************************************************/
  98.  
  99. #define    PDCURSES    1    /* PDCurses-only routines    */
  100. #define    XOPEN        1    /* X/Open Curses routines    */
  101. #define    SYSV        1    /* System V Curses routines    */
  102. #define    BSD        1    /* BSD Curses routines        */
  103. #define    INTERNAL    1    /* PDCurses Internal routines    */
  104.  
  105.  
  106. /*----------------------------------------
  107. *       BORLAND COMPILERS       Turbo C[++], Borland C[++]
  108. *
  109. *       Borland definitions:
  110. *               TC
  111. *               DOS
  112. *               OS2
  113. *               CPLUSPLUS
  114. *
  115. *               __TURBOC__, __MSDOS__ and __OS2__ are predefined by compiler.
  116. */
  117. #ifdef __TURBOC__              /* Borland gives defines this as a value*/
  118. #  define TC    __TURBOC__     /* Define a value for TC                */
  119. #  define ANSI  1              /* Borland supports ANSI C prototypes   */
  120. #  ifdef __MSDOS__
  121. #    define DOS 6              /* Major release of DOS supported       */
  122. #    include <bios.h>
  123. #    include <dos.h>
  124. #  endif
  125. #  ifdef __OS2__
  126. #    define OS2 2                   /* Major release of OS/2 supported */
  127. #    define INCL_VIO
  128. #    define INCL_KBD
  129. #    include <os2.h>
  130. #  endif
  131. #  if __TURBOC__ >= 0x290
  132. #    ifdef  __BCPLUSPLUS__
  133. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  134. #    endif
  135. #    ifdef  __TCPLUSPLUS__
  136. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  137. #    endif
  138. #    ifdef  __CPLUSPLUS__
  139. #      define CPLUSPLUS   1    /* Define that we are compiling C++.    */
  140. #    endif
  141. #  endif
  142. #endif
  143.  
  144.  
  145. /*----------------------------------------
  146. *       METAWARE COMPILERS      High C
  147. *
  148. *       Metaware definitions:
  149. *               HC
  150. *               DOS
  151. *               FLEXOS
  152. */
  153. #ifdef __HIGHC__
  154. #  define HC    1
  155. #  pragma off(prototype_override_warnings)
  156. #  define ANSI  1              /* Metaware supports ANSI C prototypes  */
  157. #  ifdef __MSDOS__
  158. #    define DOS 6              /* Major release of DOS supported       */
  159. #    include <bios.h>
  160. #    include <dos.h>
  161. #  endif
  162. #  ifdef __FLEXOS__            /* define this on the command line      */
  163. #    define FLEXOS 2           /* or latest major release value.       */
  164. #  endif
  165. #endif
  166.  
  167. /*----------------------------------------
  168. *       MICROSOFT COMPILERS      MSC
  169. *
  170. *       Microsoft definitions:
  171. *               MSC
  172. *               DOS || OS2
  173. */
  174. #ifdef _MSC_VER                                 /* defined by compiler */
  175. #  define MSC   1
  176. #  define ANSI  1              /* Microsoft supports ANSI C prototypes */
  177. #  ifdef __OS2__                /* You will have to define in makefile */
  178. #    define USE_OS2_H 1             /* Use the os2.h for the compiler  */
  179. #    define OS2 2                   /* Major release of OS/2 supported */
  180. #    define INCL_VIO
  181. #    define INCL_KBD
  182. #    include <os2.h>
  183. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  184. #    define FARKeyword far
  185. #    define APIRET USHORT
  186. #  else                            /* no __OS2__ define, so assume DOS */
  187. #    define DOS 6                    /* Major release of DOS supported */
  188. #    include <bios.h>
  189. #    include <dos.h>
  190. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  191. #  endif
  192. #endif
  193.  
  194. /*----------------------------------------
  195. *       MICROSOFT QUICK C COMPILERS      QC
  196. *
  197. */
  198. #ifdef _QC                                 /* defined by compiler */
  199. #  define MSC   1
  200. #  define ANSI  1              /* QuickC supports ANSI C prototypes */
  201. #  define DOS 6                    /* Major release of DOS supported */
  202. #  include <bios.h>
  203. #  include <dos.h>
  204. #  define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  205. #endif
  206.  
  207. /*----------------------------------------
  208. *       TOPSPEED compilers     TSC
  209. *
  210. *       TOPSPEED definitions:
  211. *               TSC
  212. *               DOS || OS2
  213. */
  214. #ifdef __TSC__                   /* You may have to define in makefile */
  215. #  define TSC   1
  216. #  define ANSI  1              /* TopSpeed supports ANSI C prototypes  */
  217. #  ifdef __OS2__
  218. #    define OS2 2                   /* Major release of OS/2 supported */
  219. #    include <cursos2.h>
  220. #  endif
  221. #endif
  222.  
  223. /*----------------------------------------
  224. *       IBM C Set/2 Compiler   CSET2
  225. *
  226. *       IBM definitions:
  227. *               CSET2
  228. *               OS2
  229. */
  230. #ifdef __IBMC__
  231. #  define CSET2 1
  232. #  define ANSI  1               /* C Set/2 supports ANSI C prototypes  */
  233. #  ifdef __OS2__
  234. #    define OS2 2                   /* Major release of OS/2 supported */
  235. #    define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  236. #    define INCL_VIO
  237. #    define INCL_KBD
  238. #    include <os2.h>
  239. #  endif
  240. #endif
  241.  
  242. /*----------------------------------------
  243. *       GNU compilers     emx
  244. *
  245. *       emx definitions:
  246. *               EMX
  247. *               OS2
  248. */
  249. #ifdef __EMX__                   /* You may have to define in makefile */
  250. #  define EMX   1
  251. #  define ANSI  1                   /* GNU supports ANSI C prototypes  */
  252. #  ifdef __OS2__
  253. #    define OS2 2                   /* Major release of OS/2 supported */
  254. #    define CURSES__32BIT__
  255. #    include <cursos2.h>
  256. #  endif
  257. #endif
  258.  
  259. /*----------------------------------------
  260. *       GNU compilers     djgpp
  261. *
  262. *        djgpp definitions:
  263. *                GO32
  264. *                DOS
  265. */
  266. #ifdef __GO32__                   /* You may have to define in makefile */
  267. #  define GO32    1
  268. #  define ANSI  1                   /* GNU supports ANSI C prototypes  */
  269. #  define DOS    6
  270. #     include <dos.h>
  271. #  ifdef __FLEXOS__            /* define this on the command line       */
  272. #    define FLEXOS 2           /* or latest major release value.       */
  273. #  endif
  274. #  define CURSES__32BIT__
  275. #  ifdef _cplusplus
  276. #     define CPLUSPLUS 1
  277. #  endif
  278. #  define NO_VSSCANF 1 /* define if no vsscanf() function in library */
  279. #endif
  280.  
  281. /*----------------------------------------
  282. *       Watcom C/386 9.0X compiler
  283. *
  284. *       WATCOM definitions:
  285. *               WATCOMC
  286. *               OS2
  287. */
  288. #ifdef __WATCOMC__
  289. #  define WATCOMC  1
  290. #  define ANSI  1          /* Watcom C/386 supports ANSI C prototypes  */
  291. #  ifdef __OS2__
  292. #    define OS2 2                   /* Major release of OS/2 supported */
  293. #    define CURSES__32BIT__
  294. #    define NO_MEMORY_H      /* this compiler does not have a memory.h */
  295. #    define INCL_VIO
  296. #    define INCL_KBD
  297. #    include <os2.h>
  298. #  endif
  299. #endif
  300.  
  301. /*----------------------------------------
  302. *       gcc under UNIX
  303. *
  304. *       GNU definitions:
  305. *               UNIX
  306. */
  307. #ifdef UNIX
  308. #  define ANSI  1                 /* GNU C supports ANSI C prototypes  */
  309. #  ifdef SUNOS
  310. #    define NO_VSSCANF
  311. #    define NO_MEMMOVE
  312. #    undef BSD
  313. #  endif
  314. #  ifdef LINUX
  315. #    undef BSD
  316. #  endif
  317. #endif
  318.  
  319. #ifdef NO_MEMMOVE
  320. #define memmove PDC_memmove
  321. #endif
  322.  
  323. /*---------------------------------------------------------------------*/
  324. #include <stdio.h>        /* Required by X/Open usage below    */
  325. /*----------------------------------------------------------------------
  326.  *
  327.  *    PDCurses Manifest Constants
  328.  *
  329.  */
  330. #ifndef FALSE            /* booleans         */
  331. #  define    FALSE    0
  332. #endif
  333. #ifndef    TRUE            /* booleans         */
  334. #  define    TRUE    !FALSE
  335. #endif
  336. #ifndef    NULL
  337. #  define NULL    ((void*)0)    /* Null pointer         */
  338. #endif
  339. #ifndef    ERR
  340. #  define     ERR    0        /* general error flag     */
  341. #endif
  342. #ifndef    OK
  343. #  define     OK    1        /* general OK flag     */
  344. #endif
  345.  
  346.  
  347.  
  348.  
  349. /*----------------------------------------------------------------------
  350.  *
  351.  *    PDCurses Type Declarations
  352.  *
  353.  */
  354. typedef unsigned char bool;    /* PDCurses Boolean type    */
  355. #ifdef UNIX
  356. #ifndef CHTYPE_LONG
  357. #define CHTYPE_LONG
  358. #endif
  359. #endif
  360.  
  361. #ifdef CHTYPE_LONG
  362. typedef unsigned long chtype;    /* 16-bit attr + 16-bit char    */
  363. #else
  364. typedef unsigned short chtype;    /* 8-bit attr + 8-bit char    */
  365. #endif
  366.  
  367.  
  368.  
  369.  
  370. /*----------------------------------------------------------------------
  371.  *
  372.  *    PDCurses Structure Definitions:
  373.  *
  374.  */
  375. typedef struct _win        /* definition of a window.       */
  376. {
  377.     int    _cury;        /* current pseudo-cursor       */
  378.     int    _curx;
  379.     int    _maxy;        /* max window coordinates       */
  380.     int    _maxx;
  381.     int    _pmaxy;        /* max physical size           */
  382.     int    _pmaxx;
  383.     int    _begy;        /* origin on screen           */
  384.     int    _begx;
  385.     int    _flags;        /* window properties           */
  386.     chtype    _attrs;        /* standard A_STANDOUT attributes and colors  */
  387.     int    _tabsize;    /* tab character size           */
  388.     bool    _clear;        /* causes clear at next refresh       */
  389.     bool    _leave;        /* leaves cursor as it happens       */
  390.     bool    _scroll;    /* allows window scrolling       */
  391.     bool    _nodelay;    /* input character wait flag       */
  392.     bool    _use_keypad;    /* flags keypad key mode active       */
  393.     bool    _use_idl;    /* True if Ins/Del line can be used*/
  394.     chtype**_y;        /* pointer to line pointer array   */
  395.     int*    _firstch;    /* first changed character in line */
  396.     int*    _lastch;    /* last changed character in line  */
  397.     int    _tmarg;    /* top of scrolling region       */
  398.     int    _bmarg;    /* bottom of scrolling region       */
  399.     chtype    _borderchars[8];/* non-std border chars           */
  400.     char*    _title;        /* window title               */
  401.     char    _title_ofs;    /* window title offset from left   */
  402.     chtype    _title_attr;    /* window title attributes       */
  403.     chtype    _blank;        /* window's blank character       */
  404. struct    _win*    _parent;    /* subwin's pointer to parent win  */
  405. }    WINDOW;
  406.  
  407.  
  408.  
  409. /*----------------------------------------------------------------------
  410. *
  411. *    Private structures that are necessary for correct
  412. *    macro construction.
  413. *
  414. */
  415.  
  416. #ifdef    REGISTERWINDOWS
  417. typedef struct _ref        /* Refresh Window Structure     */
  418. {
  419.     WINDOW*    win;
  420. struct    _ref*    next;
  421. struct    _ref*    tail;
  422. }    ACTIVE;
  423.  
  424. typedef struct _wins
  425. {
  426.     WINDOW*        w;    /* pointer to a visible window        */
  427.     struct _wins*    next;    /* Next visible window pointer        */
  428.     struct _wins*    prev;    /* Next visible window pointer        */
  429.     struct _wins*    tail;    /* Last visible window pointer        */
  430.                 /* Only head window (stdscr) has    */
  431.                 /* a valid tail pointer.        */
  432. }    WINDS;
  433. #endif
  434.  
  435.  
  436.  
  437.  
  438. typedef struct
  439. {
  440.     bool    alive;        /* TRUE if already opened.        */
  441.     bool    autocr;        /* if lf -> crlf            */
  442.     bool    cbreak;        /* if terminal unbuffered        */
  443.     bool    echo;        /* if terminal echo            */
  444.     bool    raw_inp;    /* raw input mode (v. cooked input) */
  445.     bool    raw_out;    /* raw output mode (7 v. 8 bits)    */
  446.     bool    refrbrk;    /* if premature refresh brk allowed */
  447.     bool    orgcbr;        /* original MSDOS ^-BREAK setting   */
  448.     bool    visible_cursor; /* TRUE if cursor is visible        */
  449.     bool    audible;    /* FALSE if the bell is visual        */
  450.     bool    full_redraw;    /* TRUE for bad performance        */
  451.     bool    direct_video;    /* Allow Direct Screen Memory writes*/
  452.     bool    mono;        /* TRUE if current screen is mono.  */
  453.     bool    sizeable;    /* TRUE if adapter is resizeable.   */
  454.     bool    bogus_adapter;    /* TRUE if adapter has insane values*/
  455.     bool    shell;        /* TRUE if reset_prog_mode() needs  */
  456.                 /*    to be called.            */
  457.     chtype    blank;        /* Background character            */
  458.     chtype    orig_attr;    /* Original screen attributes        */
  459.     int    cursrow;    /* position of physical cursor        */
  460.     int    curscol;    /* position of physical cursor        */
  461.     int    cursor;        /* Current Cursor definition        */
  462.     int    video_page;    /* Current PC video page        */
  463.     int    orig_emulation; /* Original cursor emulation value  */
  464.     int    orig_cursor;    /* Original cursor size            */
  465.     int    font;        /* default font size            */
  466.     int    orig_font;    /* Original font size            */
  467.     int    lines;        /* New value for LINES            */
  468.     int    cols;        /* New value for COLS            */
  469.     int    emalloc;    /* 0x0C0C if initscr() is to reset  */
  470.                 /*     this value to TRUE;        */
  471.                 /* TRUE only if emalloc()/ecalloc() */
  472.                 /*     are is to be used;        */
  473.                 /* FALSE if malloc()/calloc() are   */
  474.                 /*     to be used.            */
  475. #ifdef OS2
  476.     VIOMODEINFO scrnmode;    /* default screen mode            */
  477.     VIOCONFIGINFO adapter;    /* Screen type                */
  478. #endif
  479. #ifdef DOS
  480.     int    scrnmode;    /* default screen mode            */
  481.     int    adapter;    /* Screen type                */
  482.     unsigned video_seg;    /* video base segment            */
  483.     unsigned video_ofs;    /* video base offset            */
  484. #endif
  485. #ifdef UNIX
  486.     int    adapter;    /* Screen type                */
  487.     int number_keys;    /* number of function keys */
  488.     char *key_seq[200];    /* key sequence ptr for function keys */
  489.     int key_num[200];    /* key numbers for function keys */
  490. #endif
  491. #ifdef    REGISTERWINDOWS
  492.     WINDS*    visible;    /* List of visible windows        */
  493.     bool    refreshall;    /* Refresh all registered windows?  */
  494. #endif
  495.  
  496. }    SCREEN;
  497.  
  498.  
  499.  
  500.  
  501.  
  502. /* external variables */
  503. extern    int    LINES;        /* terminal height        */
  504. extern    int    COLS;        /* terminal width        */
  505. extern    WINDOW*    stdscr;        /* the default screen window    */
  506. extern    SCREEN    _cursvar;    /* curses variables        */
  507.  
  508. #if    defined (INTERNAL) | defined (CURSES_LIBRARY)
  509. extern    WINDOW*    curscr;        /* the current screen image    */
  510. extern    WINDOW*    tmpwin;        /* the temporary screen image    */
  511. extern    int    _default_lines;    /* For presetting maximum lines    */
  512. #endif
  513.  
  514. #ifdef    REGISTERWINDOWS
  515. extern    ACTIVE*    CurWins;    /* Currently Visible Windows    */
  516. #endif
  517.  
  518.  
  519.  
  520.  
  521. /*man-start*********************************************************************
  522.  
  523. PDCurses Text Attributes:
  524.  
  525. To include colour in PDCurses, a number of things had to be sacrificed
  526. from the strict Unix and System V support.
  527. The main problem is fitting all character attributes and colour into
  528. an unsigned char (all 8 bits!). On System V, chtype is a long on
  529. PDCurses it is a short int.
  530.  
  531. The following is the structure of a win->_attrs chtype:
  532.  
  533. -------------------------------------------------
  534. |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
  535. -------------------------------------------------
  536.  colour number |  attrs |   character eg 'a'
  537.  
  538. the high order char is an index into an array of physical colours
  539. (defined in INITPAIR.c). 32 (5 bits) foreground/background colour
  540. combinations combined with 8 (3 bits) attribute modifiers are
  541. available.
  542.  
  543. The available attribute enhancers are bold, reverse and blink.
  544. All other Unix attributes have no effect as attributes. This
  545. limitation may be overcome in future releases by expanding chtype
  546. to a long.
  547.  
  548. **man-end**********************************************************************/
  549.  
  550. /* Video attribute definitions. */
  551. #ifdef CHTYPE_LONG
  552. #define A_NORMAL            000000000000L
  553. #define A_STANDOUT          000000200000L
  554. #define A_UNDERLINE         000000400000L
  555. #define A_REVERSE           000001000000L
  556. #define A_BLINK             000002000000L
  557. #define A_DIM               000004000000L
  558. #define A_BOLD              000010000000L
  559. #define A_ALTCHARSET        000100000000L
  560. #define A_INVIS             000020000000L
  561. #define A_PROTECT           000040000000L
  562. #define A_ATTRIBUTES        037777600000L
  563. #define A_CHARTEXT          000000177777L
  564. #define A_COLOR             017600000000L
  565.  
  566. #else
  567.  
  568. #define A_NORMAL    (chtype)0x0000        /* SysV */
  569. #define A_ALTCHARSET    (chtype)0x0000        /* X/Open    */
  570. #define A_BLINK        (chtype)0x0400        /* X/Open    */
  571. #define A_BLANK        (chtype)0x0000        /* X/Open    */
  572. #define A_BOLD        (chtype)0x0100        /* X/Open    */
  573. #define A_DIM        (chtype)0x0000        /* X/Open    */
  574. #define A_PROTECT    (chtype)0x0000        /* X/Open    */
  575. #define A_REVERSE    (chtype)0x0200        /* X/Open    */
  576. #define A_STANDOUT    ((chtype)(A_REVERSE | A_BOLD))        /* X/Open    */
  577. #define A_UNDERLINE    (chtype)0x0000        /* X/Open    */
  578. #define A_COLOR    (chtype)0xF800        /*System V    */
  579.  
  580. #define CHR_MSK        (chtype)(0xFF)        /* Obsolete    */
  581. #define ATR_MSK        (chtype)(~CHR_MSK)    /* Obsolete    */
  582. #define ATR_NRM        A_NORMAL            /* Obsolete    */
  583. #define A_CHARTEXT    CHR_MSK            /* X/Open    */
  584. #define A_ATTRIBUTES    ATR_MSK            /* X/Open    */
  585. #endif
  586.  
  587. #ifdef CHTYPE_LONG
  588.  
  589. extern chtype *acs_map;
  590.  
  591. #define ACS_BSSB    (acs_map['l'])
  592. #define ACS_SSBB    (acs_map['m'])
  593. #define ACS_BBSS    (acs_map['k'])
  594. #define ACS_SBBS    (acs_map['j'])
  595. #define ACS_SBSS    (acs_map['u'])
  596. #define ACS_SSSB    (acs_map['t'])
  597. #define ACS_SSBS    (acs_map['v'])
  598. #define ACS_BSSS    (acs_map['w'])
  599. #define ACS_BSBS    (acs_map['q'])
  600. #define ACS_SBSB    (acs_map['x'])
  601. #define ACS_SSSS    (acs_map['n'])
  602.  
  603. #define ACS_ULCORNER    ACS_BSSB
  604. #define ACS_LLCORNER    ACS_SSBB
  605. #define ACS_URCORNER    ACS_BBSS
  606. #define ACS_LRCORNER    ACS_SBBS
  607. #define ACS_RTEE        ACS_SBSS
  608. #define ACS_LTEE        ACS_SSSB
  609. #define ACS_BTEE        ACS_SSBS
  610. #define ACS_TTEE        ACS_BSSS
  611. #define ACS_HLINE       ACS_BSBS
  612. #define ACS_VLINE       ACS_SBSB
  613. #define ACS_PLUS        ACS_SSSS
  614.  
  615. #define ACS_S1    (acs_map['o'])
  616. #define ACS_S9    (acs_map['s'])
  617. #define ACS_DIAMOND    (acs_map['\''])
  618. #define ACS_CKBOARD    (acs_map['a'])
  619. #define ACS_DEGREE    (acs_map['f'])
  620. #define ACS_PLMINUS    (acs_map['g'])
  621. #define ACS_BULLET    (acs_map['~'])
  622. #define ACS_LARROW    (acs_map[','])
  623. #define ACS_RARROW    (acs_map['+'])
  624. #define ACS_DARROW    (acs_map['.'])
  625. #define ACS_UARROW    (acs_map['-'])
  626. #define ACS_BOARD    (acs_map['h'])
  627. #define ACS_LANTERN    (acs_map['i'])
  628. #define ACS_BLOCK    (acs_map['0'])
  629.  
  630. #else
  631.  
  632. /* ALTCHARSET definitions from jshumate@wrdis01.robins.af.mil */
  633. #define ACS_ULCORNER    (chtype)0xda            /* SysV        */
  634. #define ACS_LLCORNER    (chtype)0xc0            /* SysV        */
  635. #define ACS_URCORNER    (chtype)0xbf            /* SysV        */
  636. #define ACS_LRCORNER    (chtype)0xd9            /* SysV        */
  637. #define ACS_RTEE    (chtype)0xb4            /* SysV        */
  638. #define ACS_LTEE    (chtype)0xc3            /* SysV        */
  639. #define ACS_BTEE    (chtype)0xc1            /* SysV        */
  640. #define ACS_TTEE    (chtype)0xc2            /* SysV        */
  641. #define ACS_HLINE    (chtype)0xc4            /* SysV        */
  642. #define ACS_VLINE    (chtype)0xb3            /* SysV        */
  643. #define ACS_PLUS    (chtype)0xc5            /* SysV        */
  644. #define ACS_S1    (chtype)0x2d            /* SysV        */
  645. #define ACS_S9    (chtype)0x5f            /* SysV        */
  646. #define ACS_DIAMOND    (chtype)0xc5            /* SysV        */
  647. #define ACS_CKBOARD    (chtype)0xb2            /* SysV        */
  648. #define ACS_DEGREE    (chtype)0xf8            /* SysV        */
  649. #define ACS_PLMINUS    (chtype)0xf1            /* SysV        */
  650. #define ACS_BULLET    (chtype)0xf9            /* SysV        */
  651. #define ACS_LARROW    (chtype)0x3c            /* SysV        */
  652. #define ACS_RARROW    (chtype)0x3e            /* SysV        */
  653. #define ACS_DARROW    (chtype)0x76            /* SysV        */
  654. #define ACS_UARROW    (chtype)0x5e            /* SysV        */
  655. #define ACS_BOARD    (chtype)0x23            /* SysV        */
  656. #define ACS_LANTERN    (chtype)0x23            /* SysV        */
  657. #define ACS_BLOCK    (chtype)0x23            /* SysV        */
  658.  
  659. /* the following definitions can be used if you have set raw_output()
  660.    or are using the PDCurses *raw*() functions                        */
  661. #if 0
  662. #define ACS_DIAMOND    (chtype)0x04            /* SysV        */
  663. #define ACS_LARROW    (chtype)0x1b            /* SysV        */
  664. #define ACS_RARROW    (chtype)0x1a            /* SysV        */
  665. #define ACS_DARROW    (chtype)0x19            /* SysV        */
  666. #define ACS_UARROW    (chtype)0x18            /* SysV        */
  667. #define ACS_BOARD    (chtype)0xb0            /* SysV        */
  668. #define ACS_LANTERN    (chtype)0x0f            /* SysV        */
  669. #define ACS_BLOCK    (chtype)0xdb            /* SysV        */
  670. #endif
  671. #endif
  672.  
  673. /* colour attributes */
  674. #define COLOR_BLACK        0
  675. #define COLOR_BLUE        1
  676. #define COLOR_GREEN        2
  677. #define COLOR_CYAN        3
  678. #define COLOR_RED        4
  679. #define COLOR_MAGENTA        5
  680. #define COLOR_YELLOW        6
  681. #define COLOR_WHITE        7
  682.  
  683. #ifdef CHTYPE_LONG
  684. #define COLOR_PAIR(n)  ((n) << 25)
  685. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 25)
  686. #else
  687. #define COLOR_PAIR(n)  (((n) << 11) & A_ATTRIBUTES)
  688. #define PAIR_NUMBER(n) (((n) & A_COLOR) >> 11)
  689. #endif
  690.  
  691. extern int COLORS,COLOR_PAIRS;
  692. /*----------------------------------------------------------------------
  693.  *
  694.  *    Function and Keypad Key Definitions.
  695.  *    Many are just for compatibility.
  696.  *
  697.  */
  698. #define KEY_MIN         0x101   /* Minimum curses key value      */
  699. #define KEY_BREAK       0x101   /* Not on PC KBD                 */
  700. #define KEY_DOWN        0x102   /* Down arrow key                */
  701. #define KEY_UP          0x103   /* Up arrow key                  */
  702. #define KEY_LEFT        0x104   /* Left arrow key                */
  703. #define KEY_RIGHT       0x105   /* Right arrow key               */
  704. #define KEY_HOME        0x106   /* home key                      */
  705. #define KEY_BACKSPACE   0x107   /* not on pc                     */
  706. #define KEY_F0          0x108   /* function keys. space for      */
  707. #define KEY_F(n)    (KEY_F0+(n))/* 64 keys are reserved.         */
  708. #define KEY_DL          0x148   /* not on pc                     */
  709. #define KEY_IL          0x149   /* insert line                   */
  710. #define KEY_DC          0x14a   /* delete character              */
  711. #define KEY_IC          0x14b   /* insert char or enter ins mode */
  712. #define KEY_EIC         0x14c   /* exit insert char mode         */
  713. #define KEY_CLEAR       0x14d   /* clear screen                  */
  714. #define KEY_EOS         0x14e   /* clear to end of screen        */
  715. #define KEY_EOL         0x14f   /* clear to end of line          */
  716. #define KEY_SF          0x150   /* scroll 1 line forward         */
  717. #define KEY_SR          0x151   /* scroll 1 line back (reverse)  */
  718. #define KEY_NPAGE       0x152   /* next page                     */
  719. #define KEY_PPAGE       0x153   /* previous page                 */
  720. #define KEY_STAB        0x154   /* set tab                       */
  721. #define KEY_CTAB        0x155   /* clear tab                     */
  722. #define KEY_CATAB       0x156   /* clear all tabs                */
  723. #define KEY_ENTER       0x157   /* enter or send (unreliable)    */
  724. #define KEY_SRESET      0x158   /* soft/reset (partial/unreliable)*/
  725. #define KEY_RESET       0x159   /* reset/hard reset (unreliable) */
  726. #define KEY_PRINT       0x15a   /* print/copy                    */
  727. #define KEY_LL          0x15b   /* home down/bottom (lower left) */
  728. #define KEY_ABORT       0x15c   /* abort/terminate key (any)     */
  729. #define KEY_SHELP       0x15d   /* short help                    */
  730. #define KEY_LHELP       0x15e   /* long help                     */
  731. #define KEY_BTAB        0x15f   /* Back tab key                  */
  732. #define KEY_BEG         0x160   /* beg(inning) key               */
  733. #define KEY_CANCEL      0x161   /* cancel key                    */
  734. #define KEY_CLOSE       0x162   /* close key                     */
  735. #define KEY_COMMAND     0x163   /* cmd (command) key             */
  736. #define KEY_COPY        0x164   /* copy key                      */
  737. #define KEY_CREATE      0x165   /* create key                    */
  738. #define KEY_END         0x166   /* end key                       */
  739. #define KEY_EXIT        0x167   /* exit key                      */
  740. #define KEY_FIND        0x168   /* find key                      */
  741. #define KEY_HELP        0x169   /* help key                      */
  742. #define KEY_MARK        0x16a   /* mark key                      */
  743. #define KEY_MESSAGE     0x16b   /* message key                   */
  744. #define KEY_MOVE        0x16c   /* move key                      */
  745. #define KEY_NEXT        0x16d   /* next object key               */
  746. #define KEY_OPEN        0x16e   /* open key                      */
  747. #define KEY_OPTIONS     0x16f   /* options key                   */
  748. #define KEY_PREVIOUS    0x170   /* previous object key           */
  749. #define KEY_REDO        0x171   /* redo key                      */
  750. #define KEY_REFERENCE   0x172   /* ref(erence) key               */
  751. #define KEY_REFRESH     0x173   /* refresh key                   */
  752. #define KEY_REPLACE     0x174   /* replace key                   */
  753. #define KEY_RESTART     0x175   /* restart key                   */
  754. #define KEY_RESUME      0x176   /* resume key                    */
  755. #define KEY_SAVE        0x177   /* save key                      */
  756. #define KEY_SBEG        0x178   /* shifted beginning key         */
  757. #define KEY_SCANCEL     0x179   /* shifted cancel key            */
  758. #define KEY_SCOMMAND    0x17a   /* shifted command key           */
  759. #define KEY_SCOPY       0x17b   /* shifted copy key              */
  760. #define KEY_SCREATE     0x17c   /* shifted create key            */
  761. #define KEY_SDC         0x17d   /* shifted delete char key       */
  762. #define KEY_SDL         0x17e   /* shifted delete line key       */
  763. #define KEY_SELECT      0x17f   /* select key                    */
  764. #define KEY_SEND        0x180   /* shifted end key               */
  765. #define KEY_SEOL        0x181   /* shifted clear line key        */
  766. #define KEY_SEXIT       0x182   /* shifted exit key              */
  767. #define KEY_SFIND       0x183   /* shifted find key              */
  768. #define KEY_SHOME       0x184   /* shifted home key              */
  769. #define KEY_SIC         0x185   /* shifted input key             */
  770. #define KEY_SLEFT       0x187   /* shifted left arrow key        */
  771. #define KEY_SMESSAGE    0x188   /* shifted message key           */
  772. #define KEY_SMOVE       0x189   /* shifted move key              */
  773. #define KEY_SNEXT       0x18a   /* shifted next key              */
  774. #define KEY_SOPTIONS    0x18b   /* shifted options key           */
  775. #define KEY_SPREVIOUS   0x18c   /* shifted prev key              */
  776. #define KEY_SPRINT      0x18d   /* shifted print key             */
  777. #define KEY_SREDO       0x18e   /* shifted redo key              */
  778. #define KEY_SREPLACE    0x18f   /* shifted replace key           */
  779. #define KEY_SRIGHT      0x190   /* shifted right arrow           */
  780. #define KEY_SRSUME      0x191   /* shifted resume key            */
  781. #define KEY_SSAVE       0x192   /* shifted save key              */
  782. #define KEY_SSUSPEND    0x193   /* shifted suspend key           */
  783. #define KEY_SUNDO       0x194   /* shifted undo key              */
  784. #define KEY_SUSPEND     0x195   /* suspend key                   */
  785. #define KEY_UNDO        0x196   /* undo key                      */
  786.  
  787. /* PDCurses specific key definitions */
  788.  
  789. #define ALT_0           0x197   /* Alt-0                PC only  */
  790. #define ALT_1           0x198   /* Alt-1                PC only  */
  791. #define ALT_2           0x199   /* Alt-2                PC only  */
  792. #define ALT_3           0x19a   /* Alt-3                PC only  */
  793. #define ALT_4           0x19b   /* Alt-4                PC only  */
  794. #define ALT_5           0x19c   /* Alt-5                PC only  */
  795. #define ALT_6           0x19d   /* Alt-6                PC only  */
  796. #define ALT_7           0x19e   /* Alt-7                PC only  */
  797. #define ALT_8           0x19f   /* Alt-8                PC only  */
  798. #define ALT_9           0x1a0   /* Alt-9                PC only  */
  799. #define ALT_A           0x1a1   /* Alt-A                PC only  */
  800. #define ALT_B           0x1a2   /* Alt-B                PC only  */
  801. #define ALT_C           0x1a3   /* Alt-C                PC only  */
  802. #define ALT_D           0x1a4   /* Alt-D                PC only  */
  803. #define ALT_E           0x1a5   /* Alt-E                PC only  */
  804. #define ALT_F           0x1a6   /* Alt-F                PC only  */
  805. #define ALT_G           0x1a7   /* Alt-G                PC only  */
  806. #define ALT_H           0x1a8   /* Alt-H                PC only  */
  807. #define ALT_I           0x1a9   /* Alt-I                PC only  */
  808. #define ALT_J           0x1aa   /* Alt-J                PC only  */
  809. #define ALT_K           0x1ab   /* Alt-K                PC only  */
  810. #define ALT_L           0x1ac   /* Alt-L                PC only  */
  811. #define ALT_M           0x1ad   /* Alt-M                PC only  */
  812. #define ALT_N           0x1ae   /* Alt-N                PC only  */
  813. #define ALT_O           0x1af   /* Alt-O                PC only  */
  814. #define ALT_P           0x1b0   /* Alt-P                PC only  */
  815. #define ALT_Q           0x1b1   /* Alt-Q                PC only  */
  816. #define ALT_R           0x1b2   /* Alt-R                PC only  */
  817. #define ALT_S           0x1b3   /* Alt-S                PC only  */
  818. #define ALT_T           0x1b4   /* Alt-T                PC only  */
  819. #define ALT_U           0x1b5   /* Alt-U                PC only  */
  820. #define ALT_V           0x1b6   /* Alt-V                PC only  */
  821. #define ALT_W           0x1b7   /* Alt-W                PC only  */
  822. #define ALT_X           0x1b8   /* Alt-X                PC only  */
  823. #define ALT_Y           0x1b9   /* Alt-Y                PC only  */
  824. #define ALT_Z           0x1ba   /* Alt-Z                PC only  */
  825. #define CTL_LEFT        0x1bb   /* Control-Left-Arrow   PC only  */
  826. #define CTL_RIGHT       0x1bc   /* Control-Right-Arrow  PC only  */
  827. #define CTL_PGUP        0x1bd   /* Control-PgUp         PC only  */
  828. #define CTL_PGDN        0x1be   /* Control-PgDn         PC only  */
  829. #define CTL_HOME        0x1bf   /* Control-Home         PC only  */
  830. #define CTL_END         0x1c0   /* Control-End          PC only  */
  831. #define KEY_BACKTAB     0x1c1   /* Back-tab             PC only  */
  832.  
  833. #if defined(FLEXOS) || defined(UNIX)
  834. #define KEY_A1          KEY_HOME/* upper left on Virtual keypad  */
  835. #define KEY_A2          KEY_UP  /* upper middle on Virt. keypad  */
  836. #define KEY_A3          KEY_PPAGE/* upper right on Vir. keypad   */
  837. #define KEY_B1          KEY_LEFT/* middle left on Virt. keypad   */
  838. #define KEY_B2          0x00    /* center on Virt. keypad        */
  839. #define KEY_B3          KEY_RIGHT/* middle right on Vir. keypad  */
  840. #define KEY_C1          KEY_LL  /* lower left on Virt. keypad    */
  841. #define KEY_C2          KEY_DOWN /* lower middle on Virt. keypad */
  842. #define KEY_C3          KEY_NPAGE /* lower right on Vir. keypad  */
  843. #define KEY_MAX         KEY_BACKTAB /* Maximum curses key        */
  844. #endif
  845.  
  846.  
  847. #if defined(DOS)  || defined (OS2)
  848. #define KEY_A1          0x1c2   /* upper left on Virtual keypad  */
  849. #define KEY_A2          0x1c3   /* upper middle on Virt. keypad  */
  850. #define KEY_A3          0x1c4   /* upper right on Vir. keypad    */
  851. #define KEY_B1          0x1c5   /* middle left on Virt. keypad   */
  852. #define KEY_B2          0x1c6   /* center on Virt. keypad        */
  853. #define KEY_B3          0x1c7   /* middle right on Vir. keypad   */
  854. #define KEY_C1          0x1c8   /* lower left on Virt. keypad    */
  855. #define KEY_C2          0x1c9   /* lower middle on Virt. keypad  */
  856. #define KEY_C3          0x1ca   /* lower right on Vir. keypad    */
  857. #define PADSLASH        0x1cb   /* slash on keypad               */
  858. #define PADENTER        0x1cc   /* enter on keypad               */
  859. #define CTL_PADENTER    0x1cd   /* ctl-enter on keypad           */
  860. #define ALT_PADENTER    0x1ce   /* alt-enter on keypad           */
  861. #define SHF_PADSTOP     0x1cf   /* shift-stop on keypad          */
  862. #define PADSTAR         0x1d0   /* star on keypad                */
  863. #define PADMINUS        0x1d1   /* minus on keypad               */
  864. #define PADPLUS         0x1d2   /* plus on keypad                */
  865. #define CTL_PADSTOP     0x1d3   /* ctl-stop on keypad            */
  866. #define CTL_PADCENTER   0x1d4   /* ctl-enter on keypad           */
  867. #define CTL_PADPLUS     0x1d5   /* ctl-plus on keypad            */
  868. #define CTL_PADMINUS    0x1d6   /* ctl-minus on keypad           */
  869. #define CTL_PADSLASH    0x1d7   /* ctl-slash on keypad           */
  870. #define CTL_PADSTAR     0x1d8   /* ctl-star on keypad            */
  871. #define ALT_PADPLUS     0x1d9   /* alt-plus on keypad            */
  872. #define ALT_PADMINUS    0x1da   /* alt-minus on keypad           */
  873. #define ALT_PADSLASH    0x1db   /* alt-slash on keypad           */
  874. #define ALT_PADSTAR     0x1dc   /* alt-star on keypad            */
  875. #define CTL_INS         0x1dd   /* ctl-insert                    */
  876. #define ALT_DEL         0x1de   /* alt-delete                    */
  877. #define ALT_INS         0x1df   /* alt-insert                    */
  878. #define CTL_UP          0x1e0   /* ctl-up arrow                  */
  879. #define CTL_DOWN        0x1e1   /* ctl-down arrow                */
  880. #define CTL_TAB         0x1e2   /* ctl-tab                       */
  881. #define ALT_TAB         0x1e3   /* alt-tab                       */
  882. #define ALT_MINUS       0x1e4   /* alt-minus                     */
  883. #define ALT_EQUAL       0x1e5   /* alt-equal                     */
  884. #define ALT_HOME        0x1e6   /* alt-home                      */
  885. #define ALT_PGUP        0x1e7   /* alt-pgup                      */
  886. #define ALT_PGDN        0x1e8   /* alt-pgdn                      */
  887. #define ALT_END         0x1e9   /* alt-end                       */
  888. #define ALT_UP          0x1ea   /* alt-up arrow                  */
  889. #define ALT_DOWN        0x1eb   /* alt-down arrow                */
  890. #define ALT_RIGHT       0x1ec   /* alt-right arrow               */
  891. #define ALT_LEFT        0x1ed   /* alt-left arrow                */
  892. #define ALT_ENTER       0x1ee   /* alt-enter                     */
  893. #define ALT_ESC         0x1ef   /* alt-escape                    */
  894. #define ALT_BQUOTE      0x1f0   /* alt-back quote                */
  895. #define ALT_LBRACKET    0x1f1   /* alt-left bracket              */
  896. #define ALT_RBRACKET    0x1f2   /* alt-right bracket             */
  897. #define ALT_SEMICOLON   0x1f3   /* alt-semi-colon                */
  898. #define ALT_FQUOTE      0x1f4   /* alt-forward quote             */
  899. #define ALT_COMMA       0x1f5   /* alt-comma                     */
  900. #define ALT_STOP        0x1f6   /* alt-stop                      */
  901. #define ALT_FSLASH      0x1f7   /* alt-forward slash             */
  902. #define ALT_BKSP        0x1f8   /* alt-backspace                 */
  903. #define CTL_BKSP        0x1f9   /* ctl-backspace                 */
  904. #define CTL_PAD0        0x1fa   /* ctl-keypad 0                  */
  905. #define CTL_PAD1        0x1fb   /* ctl-keypad 1                  */
  906. #define CTL_PAD2        0x1fc   /* ctl-keypad 2                  */
  907. #define CTL_PAD3        0x1fd   /* ctl-keypad 3                  */
  908. #define CTL_PAD4        0x1fe   /* ctl-keypad 4                  */
  909. #define CTL_PAD5        0x1ff   /* ctl-keypad 5                  */
  910. #define CTL_PAD6        0x200   /* ctl-keypad 6                  */
  911. #define CTL_PAD7        0x201   /* ctl-keypad 7                  */
  912. #define CTL_PAD8        0x202   /* ctl-keypad 8                  */
  913. #define CTL_PAD9        0x203   /* ctl-keypad 9                  */
  914. #define CTL_DEL         0x204   /* clt-delete                    */
  915. #define ALT_BSLASH      0x205   /* alt-back slash                */
  916. #define CTL_ENTER       0x206   /* ctl-enter                     */
  917. #define KEY_MAX         CTL_ENTER  /* Maximum curses key         */
  918. #endif
  919.  
  920.  
  921.  
  922. /*----------------------------------------------------------------------
  923. *       PDCurses function declarations
  924. */
  925. #ifdef ANSI
  926. #  ifdef   CPLUSPLUS
  927.      extern "C" {
  928. #  endif
  929. int     typeahead( int );
  930. char    erasechar( void );
  931. char    killchar( void );
  932. char    wordchar( void );
  933. char    breakchar( void );
  934. char*   longname( void );
  935. char*   unctrl( chtype );
  936. int     baudrate( void );
  937. int     beep( void );
  938. int     border( chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  939. int     can_change_color ( void );
  940. int     clearok( WINDOW*, bool );
  941. int     color_content( int, short*, short*, short* );
  942. int     copywin( WINDOW*, WINDOW*, int, int, int, int, int, int, bool );
  943. int     def_prog_mode( void );
  944. int     def_shell_mode( void );
  945. int     delwin( WINDOW* );
  946. int     delay_output(  int  );
  947. int     doupdate( void );
  948. int     endwin( void );
  949. int     flash( void );
  950. int     flushinp( void );
  951. int     has_colors( void );
  952. int     init_color( int, short, short, short );
  953. int     init_pair( int, short, short );
  954. int     intrflush(  WINDOW*, bool  );
  955. char *  keyname(  int  );
  956. int     mvaddrawch( int, int, chtype );
  957. int     mvaddrawstr( int, int, char* );
  958. int     mvcur( int, int, int, int );
  959. int     mvinsrawch( int, int, chtype );
  960. int     mvprintw( int, int, char*,... );
  961. int     mvwin( WINDOW*, int, int );
  962. int     mvwinsrawch( WINDOW*, int, int, chtype );
  963. int     mvwprintw( WINDOW*, int, int, char*,... );
  964. int     noraw( void );
  965. int     overlay( WINDOW*, WINDOW* );
  966. int     overwrite( WINDOW*, WINDOW* );
  967. int     pair_content( int, short*, short* );
  968. int     pnoutrefresh( WINDOW*, int, int, int, int, int, int );
  969. int     prefresh( WINDOW*, int, int, int, int, int, int );
  970. int     printw( char*,... );
  971. int     raw( void );
  972. int     refresh( void );
  973. int     resetterm( void );
  974. int     resetty( void );
  975. int     reset_prog_mode( void );
  976. int     reset_shell_mode( void );
  977. int     saveoldterm( void );
  978. int     saveterm( void );
  979. int     savetty( void );
  980. int     scroll( WINDOW* );
  981. int     start_color( void );
  982. int     tabsize( int );
  983. int     touchline( WINDOW*, int ,int );
  984. int     touchwin( WINDOW* );
  985. int     waddrawstr( WINDOW*, char* );
  986. int     waddstr( WINDOW*, char* );
  987. int     wattroff( WINDOW*, int );
  988. int     wattron( WINDOW*, int );
  989. int     wattrset( WINDOW*, int );
  990. int     wborder( WINDOW*, chtype, chtype, chtype, chtype, chtype, chtype, chtype, chtype );
  991. int     wbox( WINDOW*, int, int, int, int, chtype, chtype );
  992. int     wclrtobot( WINDOW* );
  993. int     wclrtoeol( WINDOW* );
  994. int     wdelch( WINDOW* );
  995. int     wdeleteln( WINDOW* );
  996. int     werase( WINDOW* );
  997. int     wgetch( WINDOW* );
  998. int     wgetstr( WINDOW*, char* );
  999. int     winsch( WINDOW*, chtype );
  1000. int     winsertln( WINDOW* );
  1001. int     wmove( WINDOW*, int, int );
  1002. int     wnoutrefresh( WINDOW* );
  1003. int     wprintw( WINDOW*, char*,... );
  1004. int     wrefresh( WINDOW* );
  1005. int     wsetscrreg( WINDOW*, int, int );
  1006. int     wtabsize( WINDOW*, int );
  1007. int     wungetch( chtype );
  1008. SCREEN* newterm( char*, FILE*, FILE* );
  1009. SCREEN* set_term( SCREEN* );
  1010. WINDOW* initscr( void );
  1011. WINDOW* newpad( int, int );
  1012. WINDOW* newwin( int, int, int, int );
  1013. WINDOW* subwin( WINDOW*, int, int, int, int );
  1014. int     meta( WINDOW*, bool );
  1015. int     gettmode( void );
  1016. int     fixterm( void );
  1017. int     cursoff( void );
  1018. int     curson( void );
  1019. int     curs_set( int );
  1020.  
  1021. #ifdef     PDCURSES
  1022. int     resize( int );
  1023. int     win_print( WINDOW*, int );
  1024. WINDOW* resize_win( WINDOW*, int, int );
  1025. int     raw_output( bool );
  1026. #endif
  1027.  
  1028. int     scanw( char*,... );
  1029. int     mvscanw( int, int, char*,... );
  1030. int     mvwscanw( WINDOW*, int, int, char*,... );
  1031. int     wscanw( WINDOW*, char*,... );
  1032.  
  1033. /*
  1034. *       Keep the compiler happy with our macros below...
  1035. */
  1036. int     PDC_chadd( WINDOW*, chtype, bool, bool );
  1037. int     PDC_chins( WINDOW*, chtype, bool );
  1038.  
  1039. #  ifdef   CPLUSPLUS
  1040.      }
  1041. #  endif
  1042. #endif
  1043.  
  1044.  
  1045.  
  1046. /*
  1047. *       Functions defined as macros
  1048. */
  1049. #ifndef max
  1050. #define max(a,b) (((a) > (b)) ? (a) : (b))
  1051. #endif
  1052. #ifndef min
  1053. #define min(a,b) (((a) < (b)) ? (a) : (b))
  1054. #endif
  1055.  
  1056.  
  1057. #define addch( c )              waddch( stdscr, c )
  1058. #define addstr(str)             waddstr( stdscr, str )
  1059. #define attroff(attr)           wattroff( stdscr, (chtype)attr )
  1060. #define attron(attr)            wattron( stdscr, (chtype)attr )
  1061. #define attrset(attr)           wattrset( stdscr, (chtype)attr )
  1062. #define box( w, v, h )          wbox( w, 0, 0, 0, 0, v, h )
  1063. #define clear()                 (clearok( stdscr, TRUE )==ERR?ERR:wclear( stdscr ))
  1064. #define clrtobot()              wclrtobot( stdscr )
  1065. #define clrtoeol()              wclrtoeol( stdscr )
  1066. #define delch()                 wdelch( stdscr )
  1067. #define deleteln()              wdeleteln( stdscr )
  1068. #define erase()                 werase( stdscr )
  1069. #define getch()                 wgetch(stdscr)
  1070. #define getstr(str)             wgetstr( stdscr, str )
  1071. #define getyx(w,y,x)            ( y = (w)->_cury, x = (w)->_curx )
  1072. #define getbegyx(w,y,x)         ( y = (w)->_begy, x = (w)->_begx )
  1073. #define getmaxyx(w,y,x)         ( y = (w)->_maxy, x = (w)->_maxx )
  1074. #define has_colors()            ((_cursvar.mono) ? FALSE : TRUE)
  1075. #define idlok(w,flag)           OK
  1076. #define inch()                  (stdscr->_y[stdscr->_cury][stdscr->_curx])
  1077. #define insch( c )              winsch( stdscr, c )
  1078. #define insertln()              winsertln( stdscr )
  1079. #define isendwin()              ((_cursvar.alive) ? FALSE : TRUE)
  1080. #define keypad(w,flag)          (w->_use_keypad  = flag)
  1081. #define leaveok(w,flag)         (w->_leave   = flag)
  1082. #define move(y,x)               wmove( stdscr, y, x )
  1083. #define mvaddch(y,x,c)          (move( y, x )==ERR?ERR:addch( c ))
  1084. #define mvaddstr(y,x,str)       (move( y, x )==ERR?ERR:addstr( str ))
  1085. #define mvdelch(y,x)            (move( y, x )==ERR?ERR:wdelch( stdscr ))
  1086. #define mvgetch(y,x)            (move( y, x )==ERR?ERR:wgetch(stdscr))
  1087. #define mvgetstr(y,x,str)       (move( y, x )==ERR?ERR:wgetstr( stdscr, str ))
  1088. #define mvinch(y,x)             (wmove(stdscr,y,x)==ERR?ERR:(w->_y[y][x]))
  1089. #define mvinsch(y,x,c)          (move( y, x )==ERR?ERR:winsch( stdscr, c ))
  1090. #define mvwaddch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:waddch( w, c ))
  1091. #define mvwaddstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:waddstr( w, str ))
  1092. #define mvwaddrawch(w,y,x,c)    (wmove( w, y, x )==ERR?ERR:waddrawch( w, c ))
  1093. #define mvwaddrawstr(w,y,x,str) (wmove( w, y, x )==ERR?ERR:waddrawstr( w, str ))
  1094. #define mvwdelch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wdelch( w ))
  1095. #define mvwgetch(w,y,x)         (wmove( w, y, x )==ERR?ERR:wgetch( w ))
  1096. #define mvwgetstr(w,y,x,str)    (wmove( w, y, x )==ERR?ERR:wgetstr( w, str ))
  1097. #define mvwinch(w,y,x)          (wmove(w,y,x)==ERR?ERR:(w->_y[y][x]))
  1098. #define mvwinsch(w,y,x,c)       (wmove( w, y, x )==ERR?ERR:winsch( w, c ))
  1099. #define napms(ms)               delay_output(ms)
  1100. #define refresh()               wrefresh( stdscr )
  1101. #define scrollok(w,flag)        (w->_scroll  = flag)
  1102. #define setscrreg(top, bot)     wsetscrreg( stdscr, top, bot )
  1103. #define standend()              wstandend( stdscr )
  1104. #define standout()              wstandout( stdscr )
  1105. #define traceon()               {trace_on = TRUE;}
  1106. #define traceoff()              {trace_on = FALSE;}
  1107. #define ungetch(c)              wungetch(c)
  1108. #define waddch(w, c)            PDC_chadd( w, (chtype)c, (bool)!(_cursvar.raw_out), TRUE )
  1109. #define wclear(w)               ( werase( w )==ERR?ERR:(w->_clear = TRUE))
  1110. #define winch(w)                (w->_y[w->_cury][w->_curx])
  1111. #define wstandend(w)            (wattroff(w, A_STANDOUT)==ERR?ERR:(w->_attrs = 0))
  1112. #define wstandout(w)            wattrset(w, A_STANDOUT);
  1113. #define echochar(c)             (addch((chtype)c)==ERR?ERR:refresh())
  1114. #define wechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:wrefresh(w))
  1115. #define pechochar(w,c)          (waddch(w,(chtype)c)==ERR?ERR:prefresh(w))
  1116. #define nl()                    (_cursvar.autocr = TRUE)
  1117. #define nonl()                  (_cursvar.autocr = FALSE)
  1118.  
  1119. #ifndef UNIX
  1120. #define cbreak()                (_cursvar.cbreak = TRUE)
  1121. #define nocbreak()              (_cursvar.cbreak = FALSE)
  1122. #define crmode()                (_cursvar.cbreak = TRUE)
  1123. #define nocrmode()              (_cursvar.cbreak = FALSE)
  1124. #define echo()                  (_cursvar.echo = TRUE)
  1125. #define noecho()                (_cursvar.echo = FALSE)
  1126. #define nodelay(w,flag)         (w->_nodelay = flag)
  1127. #endif
  1128.  
  1129. #ifdef     PDCURSES
  1130. #define addrawch( c )           waddrawch( stdscr, c )
  1131. #define addrawstr(str)          waddrawstr( stdscr, str )
  1132. #define insrawch( c )           winsrawch( stdscr, c )
  1133. #define waddrawch(w, c)         PDC_chadd( w, (chtype)c, FALSE, TRUE )
  1134. #define winsrawch(w, c)         PDC_chins( w, (chtype)c, FALSE )
  1135.  
  1136. /*
  1137.  *      FYI: Need to document these functions...
  1138.  */
  1139. #define title(s,a)              wtitle( stdscr, s, (chtype)a )
  1140. #define titleofs(ofs)           wtitleofs( stdscr, ofs )
  1141. #define wtitle(w,s,a)           (w->_title = s, w->_title_attr = (chtype)a)
  1142. #define wtitleofs(w,ofs)        (w->_title_ofs = ofs)
  1143. #endif
  1144.  
  1145. /*
  1146.  *      Load up curspriv.h.     This should be in the same place as
  1147.  *      curses.h.  We allow anyone who defines CURSES_LIBRARY to have
  1148.  *      access to our internal routines.  This provides quick
  1149.  *      PC applications at the expense of portability.
  1150.  */
  1151. #if defined     (CURSES_LIBRARY) | defined( INTERNAL)
  1152. #  include <curspriv.h>
  1153. #  include <stdlib.h>
  1154. #endif
  1155.  
  1156. #endif  /* __PDCURSES__ */
  1157.